/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/valid-palindrome
   @Language: C++
   @Datetime: 19-08-29 14:57
   */

class Solution {
	public:
		bool isPalindrome(string &s) {
			for(int i=0, j=s.length()-1; i<j; ++i, --j){
				for(; i<j && !isalnum(s[i]); ++i);
				for(; i<j && !isalnum(s[j]); --j);
				if(tolower(s[i])!=tolower(s[j])) return false;
			}
			return true;
		}
};
